#include "blob.h"


namespace vortex
{
    uint32_t ShapeSize(const std::vector<uint32_t>& shape)
    {
        assert(shape.size() > 0 && "invalid shape");
        uint32_t s = 1;
        for (auto& dim : shape)
            s *= dim;
        return s;
    }

    uint32_t ShapeStride(const std::vector<uint32_t>& shape)
    {
        assert(shape.size() > 1 && "invalid shape");
        // ignore the first dim (batch)
        uint32_t s = 1;
        for (uint32_t d = 1; d < shape.size(); ++d)
            s *= shape[d];
        return s;
    }
}
